﻿using System;
using ArithmeticLibrary;

namespace Nolineq
{
    /// <summary>
    /// Abstraktni trida pro objetky resici nelinearni rovnice.
    /// </summary>
    public abstract class EquationSolver
    {
        #region Properties

        /// <summary>
        /// Jmeno metody.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Funkce.
        /// </summary>
        public Function Function { get; set; }

        /// <summary>
        /// Zacatek intervalu.
        /// </summary>
        public double Start { get; set; }

        /// <summary>
        /// Konec intervalu.
        /// </summary>
        public double End { get; set; }

        /// <summary>
        /// Pocatecni priblizny koren.
        /// </summary>
        public double Root { get; set; }

        /// <summary>
        /// Aproximace.
        /// </summary>
        public double Approximation { get; set; }

        /// <summary>
        /// Presnost.
        /// </summary>
        public double Precision { get; set; }

        /// <summary>
        /// Maximalni pocet iteraci.
        /// </summary>
        public int MaxSteps { get; set; }

        #endregion // Properties

        #region Constructors

        /// <summary>
        /// vytvori novou instanci Equation Solver.
        /// </summary>
        /// <param name="function"></param>
        public EquationSolver(Function function, double start, double end, double root, double precision, int maxSteps)
        {
            this.Function = function;
            this.Start = start;
            this.End = end;
            this.Root = root;
            this.Precision = precision;
            this.MaxSteps = maxSteps;
        }

        #endregion // Constructors

        #region Public methods

        /// <summary>
        /// Abstraktni metoda hledajici koren rovnice.
        /// </summary>
        /// <returns>Vrati koren rovnice.</returns>
        public abstract Solution Solve();

        #endregion // Public methods
    }
}
